package com.ruoyi.sale.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sale.mapper.SaleDeliveryMapper;
import com.ruoyi.sale.domain.SaleDelivery;
import com.ruoyi.sale.service.ISaleDeliveryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 销售订单发货记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class SaleDeliveryServiceImpl implements ISaleDeliveryService 
{
    @Autowired
    private SaleDeliveryMapper saleDeliveryMapper;

    /**
     * 查询销售订单发货记录
     * 
     * @param deliveryId 销售订单发货记录主键
     * @return 销售订单发货记录
     */
    @Override
    public SaleDelivery selectSaleDeliveryByDeliveryId(Long deliveryId)
    {
        return saleDeliveryMapper.selectSaleDeliveryByDeliveryId(deliveryId);
    }

    /**
     * 查询销售订单发货记录列表
     * 
     * @param saleDelivery 销售订单发货记录
     * @return 销售订单发货记录
     */
    @Override
    public List<SaleDelivery> selectSaleDeliveryList(SaleDelivery saleDelivery)
    {
        return saleDeliveryMapper.selectSaleDeliveryList(saleDelivery);
    }

    /**
     * 新增销售订单发货记录
     * 
     * @param saleDelivery 销售订单发货记录
     * @return 结果
     */
    @Override
    public int insertSaleDelivery(SaleDelivery saleDelivery)
    {
        saleDelivery.setCreateTime(DateUtils.getNowDate());
        return saleDeliveryMapper.insertSaleDelivery(saleDelivery);
    }

    /**
     * 修改销售订单发货记录
     * 
     * @param saleDelivery 销售订单发货记录
     * @return 结果
     */
    @Override
    public int updateSaleDelivery(SaleDelivery saleDelivery)
    {
        return saleDeliveryMapper.updateSaleDelivery(saleDelivery);
    }

    /**
     * 批量删除销售订单发货记录
     * 
     * @param deliveryIds 需要删除的销售订单发货记录主键
     * @return 结果
     */
    @Override
    public int deleteSaleDeliveryByDeliveryIds(String deliveryIds)
    {
        return saleDeliveryMapper.deleteSaleDeliveryByDeliveryIds(Convert.toStrArray(deliveryIds));
    }

    /**
     * 删除销售订单发货记录信息
     * 
     * @param deliveryId 销售订单发货记录主键
     * @return 结果
     */
    @Override
    public int deleteSaleDeliveryByDeliveryId(Long deliveryId)
    {
        return saleDeliveryMapper.deleteSaleDeliveryByDeliveryId(deliveryId);
    }
}
